package cn.edu.zut.qixiang.controller;
import cn.edu.zut.qixiang.service.WeatherDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * @author 86178
 */
@RestController
@RequestMapping("/daily")
public class WeatherDailyController {

    @Autowired
    private WeatherDailyService weatherDailyService;

    @GetMapping("/temp")
    public ResponseEntity<Map<String, Integer>> getHighTemperatureCount() {
        Map<String, Integer> result = weatherDailyService.countHighTemperature();
        return ResponseEntity.ok(result);
    }

    @GetMapping("/type")
    public ResponseEntity<Map<String, Integer>> getWeatherTypeCount() {
        Map<String, Integer> result = weatherDailyService.countWeatherTypes();
        return ResponseEntity.ok(result);
    }

}